import React, {PureComponent} from 'react';
import './style.css'
import store from "../store";
import {NUMBER_TYPE} from "../constants/Constants";

class Left extends PureComponent {

    changeNum = (cnt) => {
        store.dispatch({
            type: NUMBER_TYPE,
            value: store.getState()[NUMBER_TYPE] + cnt
        })
    }

    render() {
        const butNumber = [-1, -2, -5, -10]
        return (
            <div className='left'>
                <h3>增加</h3>
                {butNumber.map((item, i) => {
                    return <div key={i}><button onClick={e => this.changeNum(item)}>{item}</button></div>
                })}
            </div>
        );
    }
}

Left.propTypes = {};

export default Left;